<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePrizesTable extends Migration
{
	public function up()
	{
		Schema::create('prizes', function(Blueprint $table) {
            $table->increments('id');
            $table->integer('product_id')->unsigned()->index()->comment('产品ID');
            $table->integer('status')->unsigned()->default(0)->comment('上架状态 0为预定上架 1为进行中 2为下架');
            $table->integer('quantity')->unsigned()->default(1)->comment('数量');
            $table->integer('remain_quantity')->unsigned()->default(1)->comment('剩余数量');
            $table->integer('redeeming_quantity')->unsigned()->default(1)->comment('已兑数量');
            $table->integer('redeemed_quantity')->unsigned()->default(1)->comment('已领数量');
            $table->integer('user_redeeming_quantity')->unsigned()->default(1)->comment('每个账号最多另几份');
            $table->integer('accumulate_point')->unsigned()->default(1)->comment('积分');
            $table->datetime('shelves_begin')->comment('上架开始时间');
            $table->datetime('shelves_end')->comment('上架结束时间');
            $table->datetime('redeeming_begin')->comment('兑奖开始时间');
            $table->datetime('redeeming_end')->comment('兑奖结束时间');
            $table->datetime('redeemed_begin')->comment('领奖开始时间');
            $table->datetime('redeemed_end')->comment('领奖结束时间');
            $table->integer('order_num')->unsigned()->default(0)->comment('排序');
            $table->boolean('delflag')->default(false)->comment('删除标志');
            $table->timestamps();
        });
	}

	public function down()
	{
		Schema::drop('prizes');
	}
}
